<!--
	1、rotation 旋转属性 
	2、EnterFrame 绑定事件，它在每一帧都会触发
	3、origin("center") 中心旋转
-->
<html>
  <head></head>
  <body>
    <div id="game"></div>
    <script type="text/javascript" src="https://rawgithub.com/craftyjs/Crafty/release/dist/crafty-min.js"></script>
    <script>

	Crafty.init(400, 400);

	var square = Crafty.e('2D, Canvas, Color');
	square.attr({
	  x: 10,
	  y: 10,
	  w: 100,
	  h: 100
	}).color('red');

	square.origin("center");

	square.bind('EnterFrame', function(){
	  this.rotation = this.rotation + 1;
	});
	  
    </script>
  </body>
</html>